package cn.handong.tool.设计模式.观察者模式;

import java.util.Vector;

public abstract class AbstractSubject implements Subject{
    Vector<Observer> vector = new Vector<Observer>();

    @Override
    public void add(Observer observer){
        vector.add(observer);
    }

    @Override
    public void remove(Observer observer){
        vector.remove(observer);
    }

    @Override
    public void notifyObservers(){
        for (Observer observer : vector) {
            observer.update();
        }
    }
}
